from datetime import datetime
from pydantic import BaseModel, Field
from typing import Optional


class StudentStatisticOut(BaseModel):
    student_id: str
    name: str
    class_name: str
    course_name: str
    score: float
    gpa: Optional[float]
    credit: float
    academic_year: str
    semester: str
    credit_gpa: float

    model_config = {"from_attributes": True}  # 替代 orm_mode


class StudentScoreModel(BaseModel):
    id: Optional[str] = Field(None, description="主键ID")
    class_name: Optional[str] = Field(None, description="班级名称")
    student_id: Optional[str] = Field(None, description="学号")
    name: Optional[str] = Field(None, description="学生姓名")
    course_name: Optional[str] = Field(None, description="课程名称")
    score: Optional[float] = Field(None, description="成绩")
    academic_year: Optional[str] = Field(None, description="学年")
    semester: Optional[str] = Field(None, description="学期")
    student_type: Optional[str] = Field(None, description="学生类型")
    college: Optional[str] = Field(None, description="学院")
    major: Optional[str] = Field(None, description="专业")
    grade: Optional[str] = Field(None, description="年级")
    student_tag: Optional[str] = Field(None, description="学生标签")
    teaching_college: Optional[str] = Field(None, description="开课学院")
    course_code: Optional[str] = Field(None, description="课程编号")
    teaching_class: Optional[str] = Field(None, description="教学班级")
    teacher: Optional[str] = Field(None, description="教师")
    credit: Optional[float] = Field(None, description="学分")
    score_note: Optional[str] = Field(None, description="成绩备注")
    exam_type: Optional[str] = Field(None, description="考试类型")
    gpa: Optional[float] = Field(None, description="绩点")
    course_tag: Optional[str] = Field(None, description="课程标签")
    course_category: Optional[str] = Field(None, description="课程类别")
    course_belonging: Optional[str] = Field(None, description="课程归属")
    course_nature: Optional[str] = Field(None, description="课程性质")
    assessment_method: Optional[str] = Field(None, description="考核方式")
    is_score_invalid: Optional[bool] = Field(None, description="成绩是否无效")
    submitter: Optional[str] = Field(None, description="提交人")
    submit_time: Optional[datetime] = Field(None, description="提交时间")
    is_degree_course: Optional[bool] = Field(None, description="是否学位课")
    gender: Optional[str] = Field(None, description="性别")
    major_direction: Optional[str] = Field(None, description="专业方向")
    course_english_name: Optional[str] = Field(None, description="课程英文名")
    remarks: Optional[str] = Field(None, description="备注")
    credit_gpa: Optional[float] = Field(None, description="学分绩点")
    course_type: Optional[str] = Field(None, description="课程类型")

    model_config = {"from_attributes": True}  # 替代 orm_mode
